package org.jc.reflect.service;

import java.lang.reflect.InvocationTargetException;

import org.jc.reflect.model.JField;
import org.jc.reflect.model.JMethod;

public interface JReflectService {

	/**
	 * Get methods of the current instance
	 * @return
	 */
	public JMethod[] getMethods();

	/**
	 * Get fields of the current instance
	 * @return
	 */
	public JField[] getFields();

	public Object invokeMethod(int i, Object[] params) throws IllegalAccessException, IllegalArgumentException,
			InvocationTargetException, NoSuchMethodException, SecurityException;

	public Object invokeMethod(JMethod jMethod, Object[] params) throws IllegalAccessException,
			IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException;

	public Object invokeMethod(String methodName, Class<?>[] paramTypes, Object[] params) throws IllegalAccessException,
			IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException;

	public Object invokeGetField(String fieldName)
			throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException;

	public Object invokeGetField(String fieldName, boolean accessible)
			throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException;

	public <T> void invokeSetField(T instance, String fieldName, Object value)
			throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException;

	public <T> void invokeSetField(T instance, String fieldName, Object value, boolean accessible)
			throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException;
}
